package com.cn.ycy;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * 在每个bean实例化 前后执行
 */
@Component
public class BeanPostProcessorDemo implements BeanPostProcessor {

  @Override
  public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
//    System.out.println("BeanPostProcessorDemo.postProcessAfterInitialization " + beanName);
    return bean;
  }

  @Override
  public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
//    System.out.println("BeanPostProcessorDemo.postProcessBeforeInitialization " + beanName);
    return bean;
  }

}
